package xyz.hujf.base.join;

/**
 * @author Hujf
 * @title: ThreadJoin
 * @date 2021-04-2119:19
 * @description: TODO
 */
public class ThreadJoin {

    public static void main(String[] args) throws InterruptedException {
        Thread thread =new Thread(()->{
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            System.out.println("child threadOne over !");
        });

        Thread thread1 = new Thread(()->{
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            System.out.println("child2 over !");

        });

        thread.start();
        thread1.start();

        System.out.println("wait all child thread over!");

        thread.join();
        thread1.join();

        System.out.println("main over ");
    }
}
